# Definition for a binary tree node.
class TreeNode:
    def __init__(self, val=0, left=None, right=None):
        self.val = val
        self.left = left
        self.right = right


root=TreeNode(1)
root.left=TreeNode(2)
root.right=TreeNode(2)
root.right.left=TreeNode(3)

def dfs(root,res):
    if root==None:
        return None
    dfs(root.left,res)
    dfs(root.right,res)
    res.append(root.val)

def postorderTraversal(root):
    res=[]
    dfs(root,res)
    return res


print(postorderTraversal(root))